package com.appkubes.mall.restful.application.admin.admin.dao;

import com.appkubes.mall.core.dao.BaseMallAdminDao;
import com.appkubes.mall.restful.application.goods.taobao.entity.dto.AdminInfoTaobaoDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface AdminDao extends BaseMallAdminDao {
    @Select("SELECT t1.admin_key,t1.img,t1.nick_name,t1.name,t1.create_time,t1.login_time,t1.user_name,t1.mobile,t1.state," +
            "t2.supplier_key,t2.customer_key,t2.taobao_pid," +
            "t3.alipay_account " +
            "FROM mall_admin AS t1 " +
            "LEFT JOIN mall_admin_binding AS t2 ON t1.admin_key=t2.admin_key " +
            "LEFT JOIN mall_admin_account AS t3 ON t1.admin_key=t3.admin_key " +
            "WHERE t1.admin_key = '${adminKey}' " +
            "LIMIT 1")
    AdminInfoTaobaoDTO getAdminInfo(@Param("adminKey") String adminKey);

}
